#pragma once
//============================================================================
// Copyright (C) 2009-2013 Brett R. Jones
//
// Issued to public domain 2013
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================
#include "VxDefs.h"
#include <string>
#include "VxInetAddress.h"
#include "VxIPv4Address.h"
#include "OnlineId.h"

#pragma pack(push) 
#pragma pack(1)
//! derived from 16 bytes
//! size 16 + 16 + 4 + 2 = 38 bytes
class VxConnectId : public OnlineId
{
public:
	//=== vars ===//
	VxInetAddress	m_oIPv6OnlineIp;							// users ip6 address
	VxIPv4Address	m_oIPv4OnlineIp;						// users ip4 address
	U16				m_u16OnlinePort;						// users incoming connection port

	VxConnectId();

	//! assignment operator
	VxConnectId& operator = ( const VxConnectId &a );
	bool operator != (const VxConnectId& oAddr) const;
	bool operator == (const VxConnectId& oAddr) const;

	void			setIpAddress( const char * pIp );
	//! get ip address based on can connect ipv6 or need ipv4
	void			getIpAddress( std::string& retString );

	VxInetAddress	getIPv4( void ) { return m_oIPv6OnlineIp; }
	VxIPv4Address	getIPv6( void )	{ return m_oIPv4OnlineIp; }
	//std::string		getIpAddress( void );
	void			getIPv4( std::string& retString );
	void			getIPv6( std::string& retString );
};
#pragma pack(pop)

